/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package orkomet;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Administrator
 */
public class Main{

    private static Main instance;
    private static MainWindow mainWindow;
    private static WsPublisher wspublisher;
    
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
           instance= new Main();
           mainWindow= new MainWindow();
           instance.startPublish();
           mainWindow.setVisible(true);  
           RDFEngine.InitLog();
           Logger.getLogger(Main.class.getName()).log(Level.INFO,java.util.ResourceBundle.getBundle("orkomet/logprops").getString("initFinished"));
    }
    
    public static Main getInstance() {
        return instance;
    }
    
    public boolean getMainState()
    {
       return wspublisher.isStartable();
    }
    
    void notifyObservers()
    {
        mainWindow.stateChanged();
    }
 
    public void endPublish()
    {
       wspublisher.endPublish();
    }
    
    public void startPublish()
    {
      
       wspublisher=new WsPublisher();
       wspublisher.start();
    }
    
    public static void shutdown()
    {
        try {
            wspublisher.endPublish();
            DerbyDAL.shutDownDerby();
        } catch (SQLException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.INFO,ex.getMessage());
        }
         System.exit(0);
    }
    
    
}
